<?php
// 获取单个商品信息
require $this->website['path']['action'] . '/admin/islogin.php';
$json = array('status' => 'error', 'msg' => '', 'data' => []);

$id = fn_post('id');

if (!$id || !is_numeric($id)) {
	$json['msg'] = '错误编号';
} else {
	$json['status'] = 'ok';
	$json['data']['product'] = $this->website['class']['db']
		->table('product')
		->where('id=?', $id)
		->one();
	$ttit = $this->website['class']['db']
		->table('type')
		->field('tit')
		->where('id=?', $json['data']['product']['tid'])
		->one();
	$json['data']['product']['ttit'] = $ttit['tit'] ?? '';
	$json['data']['image'] = $this->website['class']['db']
		->table('product_image')
		->field('image')
		->where('pid=?', $id)
		->select();
	$json['data']['detail'] = $this->website['class']['db']
		->table('product_detail')
		->field('image')
		->where('pid=?', $id)
		->select();

}

$this->json_encode($json);